home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / utilit~1 / initsnb.zoo / init / sh / readme.st < prev    next >
Encoding:
Text File  |  1992-09-09  |  8.3 KB  |  209 lines

  1. Blurb for the May 1992 distribution
  2.  
  3. This is the May 1992 distribution of the /bin/sh-compatible shell by
  4. Kenneth Almquist, called ash.  This is a port to the atari st for MiNT
  5. 0.93 (and possibly later versions, too.)  The original sources were
  6. taken from the 4.4BSD sources.
  7.  
  8. Changes in the May 1992 distribution in a nutshell:
  9.  
  10. 1. Added carriage-return stripping to backquote substitution
  11. 2. Corrected test.c
  12. 3. Added better dump scripts
  13.  
  14. Changes in detail:
  15.  
  16. 1.  The backquote substitution did strip newlines, but nor carriage
  17. returns.  Since the original author of ash used his own buffered-I/O
  18. package, I could not easily use the stdio.h routines.  That's why the
  19. bug struck.  It is fixed, and backquote substitution should not leave
  20. extraneous carriage-returns in variables or files any more.
  21.  
  22. 2.  I had mixed up the numeric and string operators, plus I named the
  23. equality testing operator ==, not =. (*blush*).  This is fixed.  Please
  24. forgive me.
  25.  
  26. 3.  The dump scripts are much better, now that they have been used in
  27. the recent level 0 dump of my hard disk.  The following programs are
  28. included: 
  29.  
  30.     dump -- dump TOS partitions, either full or incremental
  31.     usage: sh dump <level> <partition>...
  32.  
  33.     dinfo -- get information about a dump
  34.     usage: sh dinfo <partition>...
  35.  
  36.     lastdump -- say when a file or set of files was last dumped
  37.     usage: sh lastdump <regex>
  38.  
  39. Please look into the scripts before you use them; you will almost
  40. certainly have to change some path names.  If you don't have gawk, sed,
  41. or tar, get them from the excellent atari.archive.umich.edu.  If you
  42. lack /bin/time, get the GNU shell utilities 1.6, and compile.  
  43.  
  44. [N.B: But *do not use %D or %Y as the format strings!* The bug that
  45. strikes there is interesting.  Basically, what happens is:
  46.  
  47.     * GNU strftime() is POSIX, i.e., has %D and %Y.
  48.     * Atari-gcc strftime() is ANSI, i.e., doesn't have %D and %Y.
  49.     * strftime() returns 0 if *either* there is not enough room in
  50.       the string to put the formatted date, *or* no characters
  51.       could be written.  (This is such a bad design bug, that, IMHO,
  52.       the strftime() function is almost useless, because you cannot
  53.       distinguish between an overfull buffer and a bad format string.)
  54.     * GNU date doesn't check for the correctness of the format
  55.       string passed to strftime().
  56.     * When GNU date gets 0 from strftime(), it reallocs its buffer
  57.       by 200 bytes and tries again.
  58.     * strftime (buf, "%D%Y", len) will return 0 for any len, if one
  59.       uses the Atari-gcc strftime().
  60.     * You cannot easily use GNU strftime(), because the atari-gcc
  61.       strftime() refuses to be kicked out of the library.
  62.  
  63. Result: date fills up memory by repeatedly realloc()ing 200 more bytes,
  64. but does not progress.  Takes quite some time on a 4MB atari st. :-)
  65.  
  66. So either use only ANSI-style format strings, or patch date to include
  67. checking of the format string.]
  68.  
  69. Also, the dump information file, dumpinfo, gets quite large over the
  70. time.  I have written a shell script that will purge dump information
  71. selectively, e.g., for an old level 0 dump of /dev/c, but it's not
  72. tested very well, so I'm waiting until I've fixed some loose ends. 
  73.  
  74.  
  75. Future directions:
  76.  
  77. Making suffix stripping better; also, rewrite command hashing and
  78. execution; the current code is cursed.  One person has reported bugs in
  79. the signal handling code to me.  (Don't worry, they're only for stopping
  80. processes that want to do output to a terminal and are currently in the
  81. background; everything else appears to work OK.)  I'll look into that,
  82. too. 
  83.  
  84. End of blurb for the May 1992 distribution
  85.  
  86.  
  87. Original distribution: April 1992
  88.  
  89.  
  90. 0.  General Blurb
  91. -----------------
  92.  
  93. This is a port of the Berkeley 4.4BSD version of /bin/sh for MiNT.  It
  94. will probably run ONLY under MiNT; I haven't tested plain TOS.  Please
  95. mail bug reports in the MiNT port to neuhaus@informatik.uni-kl.de.  You
  96. can also write to me in paper mail.  The address is
  97.  
  98. Stephan Neuhaus
  99. Hilgardring 32
  100. D-6750 Kaiserslautern 
  101. Germany
  102.  
  103. This port has been, well, `tested' is not the right word, but it's
  104. close, on my 4MB 1040 STF with TOS 1.4, MiNT 0.93, MiNT Libraries
  105. patchlevel 19, make version 3.60 (my own port to MiNT) and gcc version
  106. 1.40.  The makefile had to be hacked, because the original makefile used
  107. some pretty heavy scripts to create some .c and .h files.  Those scripts
  108. were written for, yeah, you guessed it, /bin/sh.  I ran them on a SUN,
  109. took them to my atari, typed `make' and prayed.  No problems with these
  110. ones.  And no problems with the libraries, either.  Thank you, Eric R. 
  111. Smith and Jwahar R. Bammi! (And, of course all others who contributed
  112. to the nice development system I have running!)
  113.  
  114. While we're at it, I would like to thank ATARI for shipping such a bad OS
  115. that it inspired ERS to create MiNT.
  116.  
  117.  
  118. 1.  Things That Work and Things That Don't
  119. ------------------------------------------
  120.  
  121. I have written a quite extensive shell script to make dumps of MiNT
  122. filesystems.  It is included in the file `dump'.  If you study this
  123. script, and if you believe me that it works, you'll see that the
  124. following features provably work (at least in my case):
  125.  
  126.   * Backquote substitution
  127.   * Pipes
  128.   * Traps (as in trap <command> signo...)
  129.   * User-defined functions
  130.   * I/O redirection
  131.   * Variable substitution
  132.  
  133. However, if you actually run the script, you'll find strange things in
  134. the logs afterwards.  There appear to be stray CRs (ASCII 015) in the
  135. log files.  This is because I haven't as yet looked at the newline-
  136. stripping section in the backquote substitution code (and maybe other
  137. places as well).  Also, while typing `ls' at the shell will start up
  138. `ls.ttp' just fine, typing `/bin/ls' will not work.  If I have another
  139. day free, I will look into it.  It will be fixed RSN(tm). 
  140.  
  141. Another thing that won't work is the `#!' mechanism for executable
  142. scripts of any kind.  In UNIX, when you attempt to execute a file, and
  143. its first two characters are `#!', the kernel (!) looks in the first
  144. line for an executable program and starts it with that file as an
  145. argument.  For example, if the first line of your file reads
  146.  
  147. #! /bin/awk -f
  148.  
  149. then the file will be processed with awk.  Another common example is
  150.  
  151. #! /bin/sh
  152.  
  153. which will run your script with /bin/sh.  MiNT does not support this
  154. feature, and although sh tries to emulate it, it will still not work,
  155. because you cannot emulate executable permission on a plain text file
  156. under MiNT (with the TOS filesystem at least).
  157.  
  158. The solution is of course to specify the interpreter for your scripts
  159. explicitly.  For example, if you have a makefile that runs a shell
  160. script just by mentioning its name, you should prefix the line with `sh'
  161. and be done:
  162.  
  163. funcs.c funcs.h: mkfuncs
  164.     mkfuncs        # This is a shell script
  165.  
  166. now becomes
  167.  
  168. funcs.c funcs.h: mkfuncs
  169.     sh mkfuncs    # This is (still) a shell script
  170.  
  171.  
  172.  
  173. 2.  Bells and Whistles
  174. ----------------------
  175.  
  176. Nearly every shell script that I have seen uses the program /bin/test. 
  177. In fact, this is a trap that every UNIX programmer has fallen into at
  178. least once; when one creates test.c, and compiles it into the executable
  179. file test, and tries to run `test', one will mostly get /bin/test.  I
  180. have written my own version of /bin/test (took me half a day or so), and
  181. include it here in test.c.  The docs are in test.1  If you want to run
  182. nonportable shell scripts on your machine, I suggest making a copy of
  183. test.ttp under the name /bin/[.ttp (that's right, a square bracket). 
  184. That is because shell scripts often say something like
  185.  
  186.   if [ -d /tmp ] ; then
  187.     ...
  188.   fi
  189.  
  190. What happens is that most UNIX systems have a link from /bin/[ to
  191. /bin/test (or maybe [ ] is built into some shells).  I have written the
  192. program with the man page for SUNs beside me, so it should be pretty
  193. standard.
  194.  
  195. Other things that you should consider are the programs /bin/true
  196. (returns EXIT_SUCCESS always) and /bin/false (returns EXIT_FAILURE
  197. always). You should copy /bin/true.ttp to /bin/:.ttp.  (The programs are
  198. so trivial that I haven't included them.  I considered posting source
  199. code for /bin/true as an offense against the programming community :-)
  200.  
  201. If you make copies of the program(s) to give to your friends, please
  202. read the copyright notice in the file COPYING (for test), and the
  203. copyright notice in the file COPYING.sh (for sh).
  204.  
  205. Share and enjoy.
  206.  
  207. --
  208. Stephan
  209.